import {defineStore} from 'pinia'
import {ref} from 'vue'
import {getEmployeeInfo} from '@/api/employee'
export const useEmployeeStore=defineStore('employee',()=>{
    const employee=ref({})
    const token=ref('')
    const setToken=(newToken)=>{
        token.value=newToken
    }
    const removeToken=()=>{
        token.value=''
    }
    const getEmployee=async()=>{
        const res=await getEmployeeInfo()
        employee.value=res.data.data
    }
    const setEmployee=(obj)=>{
        employee.value=obj
    }
    return{
        token,
        setToken,
        removeToken,
        getEmployee,
        employee,
        setEmployee
    }
},{
    persist:true
})